home *** CD-ROM | disk | FTP | other *** search
/ Creative Computers / Creative Computers CD-ROM, Volume 1 (Legendary Design Technologies, Inc.)(1994).iso / shareware / fractals / cloud / cloud.doc < prev    next >
Text File  |  1994-11-17  |  16KB  |  419 lines

  1.  
  2.  
  3.                 Cloud
  4.  
  5.     "Cloud" is a program that generates and displays fractal surfaces.
  6.     I had briefly looked at 'sc', but found that it was too slow to
  7.     be interesting.  I read about generating fractal surfaces and 
  8.     displaying them as clouds in the (technical) book "Fractals", by
  9.     Jens Feder (ISBN 0-306-42851-2), section 13.4 "Random Addition
  10.     Surfaces".  So I thought I'd try it myself.  What follows are
  11.     some explanations of the program's user interface, and some of
  12.     its workings.      The clouds that look like these images are called
  13.     "fracto-cumulus" by the way.
  14.  
  15.     Requirements:  It requires about 200K to run - I've tried it on an 
  16.     A1000 with expansion memory turned off, and it works OK.
  17.  
  18. Cloud brings up a custom lo-res screen (320x200).  The screen is in two
  19. sections - the right 3/4 is where the image is displayed.  On the left of 
  20. the screen is a control panel with a bunch of gadgets. Most of these gadgets
  21. are grouped into three little panels.  From the top of the window downwards,
  22. these buttons are:
  23.  
  24.     Standard Window Close Gadget:
  25.         Exit Cloud by clicking on the window's close gadget.
  26.  
  27.     Auto - toggle to select the automatic generate and display loop.
  28.         When "auto" is set, the program will loop between generating
  29.         new images and displaying them.  To stop, toggle "auto" back
  30.         off.  To pause, toggle "pause".
  31.  
  32.     Pause - toggle to pause while in the automatic loop.
  33.         This pauses the program while in the automatic loop.
  34.         You can then select other palettes.
  35.  
  36.     Save - this will let you save the current image as an IFF file,
  37.         when it is implemented.
  38.  
  39.     '  ' - (there is an empty, unused gadget beneath Save)
  40.  
  41.     Rand - toggle to turn on the randomizer.
  42.         This enables a section of code that adjusts the random
  43.         number generator.  If you don't turn this on, you will
  44.         get the same sequence of images each time you run Cloud.
  45.  
  46.     Scroll - toggle to have the display scroll up from the bottom.
  47.         When this is off, the new image fills in from the top
  48.         of the screen downwards.  When it is on, the screen is
  49.         scrolled upwards, with the old image disappearing off the
  50.         top, and the new image appearing on the bottom.  It adds
  51.         "lightning" to the clouds.
  52.  
  53.     Gen - to generate and display a new image.
  54.         This generates a new image, and displays it.
  55.  
  56.     Re-Do - to re-display the present image.
  57.         This displays the current image again, which is useful to
  58.         see the effects the different scalings can have on the
  59.         same image.
  60.  
  61.     "d = XX %" - place to enter the delta percent value.
  62.         This string gadget accepts a two digit number whose value
  63.         is used in generating new images.  The gadget hit box
  64.         surrounds the digits.  The value determines the smoothness
  65.         of the image.  For clouds, a good value is 80%, for terrain
  66.         and water, 70% is better.  Lower and higher values are also
  67.         interesting, if less natural.
  68.  
  69.     Log - selects a logarithmic scaling,
  70.     Lin - selects a linear scaling,
  71.     Exp - selects an exponential scaling,
  72.     Histo - selects an equal area scaling between data and colors.
  73.         You choose one of these four buttons to select the type
  74.         of scaling performed to map the image data to the screen.
  75.         There's more on this later.
  76.  
  77.     Color Bar - shows the current image palette.
  78.         This isn't a gadget, it just shows you what the palette is.
  79.  
  80.     Reverse    - flips the color palette end for end.
  81.         By flipping the palette over, the image seems to reverse;
  82.         dark things become light, and light sections become dark.
  83.  
  84.     Atmos - selects the "cloud in the sky" color palette,
  85.     Earth - selects the Rand McNally map palette,
  86.     Water - selects an "islands in oceans" palette,
  87.     Therm - selects a palette that is reminiscient of thermal images.
  88.         Choose one of these four buttons to select the color palette
  89.         for displaying the image.  These are active at all times,
  90.         so that while generating the next image, you can fiddle with
  91.         the one currently on the screen.
  92.  
  93. -------------------------------------------------
  94. About the color palettes (or do you say palette?):
  95.  
  96. The following table lists the color trends in each of the palettes.
  97.  
  98. Color range    Atmos        Earth        Water        Therm
  99.         -----        -----        -----        -----
  100.   HI        white        near white    light green    red
  101.   ^         ...        dark brown    sand        orange
  102.   |        lighter blue    light brown    blue-green    yellow
  103.   |         ...        green        light blue    green
  104.   v        lighter blue    sand        blue        blue
  105.   LO        blue        lake blue    deep blue    dark blue
  106.  
  107. Data means:    density        height        depth        temperature
  108.  
  109. If you're running Workbench 1.3, you can use the Palette command to change
  110. Cloud's colors.  Put the Cloud screen in the front, pull it down to expose
  111. a CLI window or the drawer containing the "Palette" command, and invoke
  112. "Palette".  You can then change Cloud's colors temporarily - the color changes
  113. are not remembered by Cloud.  Also, there will be a white rectangle left over
  114. from where the Palette window was.  Just click on the Re-Do gadget to redraw
  115. the image.
  116.  
  117. -----------------------------
  118. About the scaling selections:
  119.  
  120. The data can be mapped to the colors in    many ways - I've chosen 4: linear,
  121. log, exponential, and equal area.   Each has its own good and bad points.
  122.  
  123. The linear scaling makes a hazy cloud, but it leaves the Earth landscape
  124. flat and boring.  This is because the majority of the data values get
  125. mapped to the middle range of the palette - so we don't see much of the
  126. peaks and pits.
  127.  
  128. The log scaling tends to expand the lower data values over a larger color
  129. range and compress the higher values into the higher colors.  It emphasizes
  130. the upper data values at the expense of the lower ones.  It makes the sky
  131. seem even more hazy.
  132.  
  133. Exponential scaling is the reverse of log scaling.  The higher data values
  134. will be spread across a greater color range, as compared with linear scaling,
  135. and the lower data values will be compressed into the lowest color(s).  It
  136. emphasizes the lower data values at the expense of the upper ones.  The sky
  137. becomes more blue with this setting.
  138.  
  139. The equal-area scaling uses a histogram to find out the distribution of the
  140. data values.  It then maps the data values to colors such that each color
  141. occurs as often as every other color.  It seems to reveal lots of detail,
  142. and so it makes Therm and Water busy looking, but it makes Atmos look better.
  143. It emphasizes the extremes of the data, both upper and lower, at the expense
  144. of the mid-range values.  The sky looks most natural with this setting - 
  145. patches of blue sky and patches of white clouds with quick transitions between.
  146.  
  147. -----------------------------
  148. About the scaling algorithms:
  149.  
  150. LINEAR scaling maps the data values to palette color positions (pen numbers)
  151. with the equation:
  152.                    Delta-C
  153.         C =  (V - VMin) *  -------  +  LoColor
  154.                        Delta-V
  155.  
  156. This divides the range VMin to VMax into NColor sections (where NColor = 
  157. HiColor - LoColor + 1).  Actually, instead of doing that equation over 
  158. 66000 times, I build a color lookup table, from the minimum data value to 
  159. the maximum data value, and use that equation NColor (13) times to fill the
  160. table.
  161.  
  162. LOGARITHMIC scaling finds the multiplicative factor such that:
  163.  
  164.                 NColor
  165.         VMax = VMin * X
  166.  
  167. This will divide the range VMin to VMax into NColor sections, each of which
  168. is X times larger than the previous.  X can be found by:
  169.  
  170.                    (1 / NColor)
  171.         X = (VMax/VMin)    
  172.  
  173. The EXPONENTIAL scaling uses the logarithmic routine to first build the
  174. color table for the logarithmic scaling.  Then it flips the table around
  175. end-for-end, and top-to-bottom.  This changes the up-and-over logarithmic
  176. curve to the over-and-up exponential curve.
  177.  
  178. HISTOGRAM scaling produces an equal-area scaling, where the range VMin to
  179. VMax is divided into NColor sections, each of which has the same number
  180. of image points within it.  To do this, a histogram is made from the image
  181. data.  The histogram is a table that  represents how many data points occur 
  182. for each data value, over all the data values (from VMin to VMax), i.e. how
  183. many data elements are at a certain height for all heights.  (Typically, the
  184. histogram looks like the infamous "bell-shaped" curve used by school teachers
  185. to place exam grades "on the curve".  This is that curve.)  Next, the histogram
  186. is summed along its values - changing the bell-curve into an stretched out
  187. S-curve:
  188.